f77e36720bc2c25593ae3508cf8ef5030f75b74c
2 * HTMLForm enhancements:
3 * Infuse some OOjs UI HTMLForm fields (those which benefit from always being infused).
7 mw
.hook( 'htmlform.enhance' ).add( function ( $root
) {
8 var $oouiNodes
, modules
;
10 $oouiNodes
= $root
.find( '.mw-htmlform-field-autoinfuse' );
11 if ( $oouiNodes
.length
) {
12 // The modules are preloaded (added server-side in HTMLFormField, and the individual fields
13 // which need extra ones), but this module doesn't depend on them. Wait until they're loaded.
14 modules
= [ 'oojs-ui-core' ];
15 if ( $oouiNodes
.filter( '.mw-htmlform-field-HTMLTitleTextField' ).length
) {
16 // FIXME: TitleInputWidget should be in its own module
17 modules
.push( 'mediawiki.widgets' );
19 if ( $oouiNodes
.filter( '.mw-htmlform-field-HTMLUserTextField' ).length
) {
20 modules
.push( 'mediawiki.widgets.UserInputWidget' );
23 $oouiNodes
.filter( '.mw-htmlform-field-HTMLSelectNamespace' ).length
||
24 $oouiNodes
.filter( '.mw-htmlform-field-HTMLSelectNamespaceWithButton' ).length
26 // FIXME: NamespaceInputWidget should be in its own module (probably?)
27 modules
.push( 'mediawiki.widgets' );
29 mw
.loader
.using( modules
).done( function () {
30 $oouiNodes
.each( function () {